package com.demiroot.server;


public class User {
	private int level;
	private String user;
	private String passwd;
	
	public User(String user, String passwd, int level) {
		this.user = user;
		this.passwd = passwd;
		this.level = level;
	}
	
	public String getUserName() {
		return user;
	}
	
	public int getLevel() {
		return level;
	}
	
	public String getPasswd() {
		return passwd;
	}
	
	public boolean passwdMatch(String result, String challenge) {
		String real = "";
		
		for (int x = 0; x < passwd.length(); x++) {
			int a = passwd.charAt(x);
			int b = challenge.charAt(x);
			int c = (a^b);
			real += (char)c;
		}
		
		real = ServerUtils.md5(real);
		return result.equals(real);
	}
}
